<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="../../../common/Style.jsp"%>
<title>千禧宝贝连锁店管理信息系统</title>

</head>
<body>
	<script>
function saveCategory(){
    if (!$('#updateCategoryForm').form('validate'))
    	return ;
	else {
	    var params=$("#updateCategoryForm").serialize();

        $.post("basicDataJSON!updateCategoryLevel",params, updateCategoryBKProcess,"json");	
	}
}

/**
 * 只有产品线可以编辑条码信息
 */
function changeCategory(value){
	if(value == 2){
		$('#categoryCode').textbox('disable');		
	}else if(value == 1){
		$('#categoryCode').textbox('enable');
	}
}

function updateCategoryBKProcess(data){
	var response = data.response;
	var returnCode = response.returnCode;
	if (returnCode != SUCCESS)
		alert(response.message);
	else {
		$.modalDialog.handler.dialog('close');
		$("#dataGrid").datagrid('reload');
	}		
}
</script>
	<s:form id="updateCategoryForm" name="updateCategoryForm" method="post"
		action="" cssClass="easyui-form" theme="simple">
		<table width="90%" border="0" style="position:relative;top:20px;left:20px;">

			<tr class="InnerTableContent">
				<td align="center"><span style="color:red">*</span><strong>名称:</strong></td>
				<td><s:hidden name="formBean.category.category_ID" /> <s:textfield
						id="categoryName" name="formBean.category.category_Name"
						cssClass="easyui-textbox" style="width:170px" 
						data-options="prompt:'请输入品类名称'" /></td>
			</tr>		
			<tr class="InnerTableContent">
				<td align="center"><span style="color:red">*</span><strong>所属 :</strong></td>
				<td><s:select id="type" cssClass="easyui-combobox" name="formBean.category.chainId" data-options="editable:false"
						style="width:170px"  list="#{-1:'总部',1:'连锁店'}" listKey="key" listValue="value" /></td>
			</tr>
			<tr class="InnerTableContent">
				<td align="center"><span style="color:red">*</span><strong>状态 :</strong></td>
				<td><s:select id="status" cssClass="easyui-combobox" name="formBean.category.status" data-options="editable:false"
						style="width:170px"  list="#{1:'正常',0:'停用'}" listKey="key" listValue="value" /></td>
			</tr>
			<tr class="InnerTableContent">
				<td align="center"><span style="color:red">*</span><strong>编码:</strong></td>
				<td>
					<s:if test="formBean.category.category_ID != 0">
						<s:textfield
						id="categoryCode" name="formBean.category.category_Code"
						cssClass="easyui-textbox" style="width:170px" 
						data-options="prompt:'产品线编码信息',readonly:true" />
					</s:if><s:else>
						<s:textfield
						id="categoryCode" name="formBean.category.category_Code"
						cssClass="easyui-textbox" style="width:170px" 
						data-options="prompt:'产品线编码信息'" />
					</s:else>
				
				</td>
			</tr>
			<tr class="InnerTableContent">
				<td></td>
				<td><a onclick="saveCategory();" data-options="iconCls:'icon-ok'"
					href="javascript:void(0);" class="easyui-linkbutton">保存</a></td>
			</tr>
		</table>
	</s:form>

</body>
</html>